package com.qf.controller;

import com.qf.pojo.LbPic;
import com.qf.service.LbPicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController("/lbpic")
public class LbPicController {
    @Autowired
    LbPicService lbPicService;
    @RequestMapping("/findLbPicAll")
    public List<LbPic> findAll(){
        return lbPicService.findAll();
    }

    @RequestMapping("/findLbPicByStatu")
    public List<LbPic> findByStatu(){
        return lbPicService.findByStatu();
    }

    @RequestMapping("/addAndUpdateLbPic")
    public String addAndUpdate(LbPic lbPic){
        int i = lbPicService.addAndUpdate(lbPic);
        if(i==1){
            return "success";
        }else {
            return "fail";
        }
    }

    @RequestMapping("/deleteByLbid")
    public void delete(@RequestBody Map map){
        Integer id = (Integer) map.get("id");
        lbPicService.delete(id);
    }
}
